package com.jw.springframework.testbeanfactorypostprocessor.beanfactorypostprocessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

/**
 * @ClassName: AddByApplicationContextBeanFactoryPostProcessor
 * @Description: 通过applicationContext.addBeanFactoryPostProcessor添加的后置处理器
 * @Author: darkness
 * @Date: 2021/4/11 0011 22:17
 * @Version: 1.0
 * @Type: class
 **/
public class AddByApplicationContextBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        System.out.println("↓ ↓ ↓ --- AddByApplicationContextBeanFactoryPostProcessor的实现bean工厂后置处理器的方法 --- ↓ ↓ ↓");
        System.out.println("--------------------------------------------------------------------------------------------------------------------------------------");
        String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
        for (String beanDefinitionName : beanDefinitionNames) {
            System.out.println(beanDefinitionName + "; ");
        }
        System.out.println("--------------------- 共" + beanDefinitionNames.length + "个beanDefinition ---------------------");
        System.out.println("--------------------------------------------------------------------------------------------------------------------------------------");
        System.out.println("↑ ↑ ↑ --- AddByApplicationContextBeanFactoryPostProcessor的实现bean工厂后置处理器的方法 --- ↑ ↑ ↑");
        System.out.println("**************************************************************************************************************************************");
    }
}
